<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script src='__PUBLIC__/Js/jquery.js'></script>
	<script src="//cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.js"></script>
	<link href="//cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
	<script src="__PUBLIC__/Js/jqui/jquery-ui.min.js"></script>
	<link rel="stylesheet" href="__PUBLIC__/Js/jqui/jquery-ui.min.css">
	<style>
		.obody{width:1000px;margin:100px auto;}
.pagediv{margin:0 auto;width:600px;}
.showord{width:1200px;border:0px solid black;margin:0 auto;}
.{border-bottom:1px solid #f1f1f1;list-style-type:none;height:50px;background-color:#D6D6D6;background-color:#d6d6d6}
.pimg{height:80px;width:80px;border-radius:4px;margin-left: 10px;margin-top: 5px;}
.s1{display:block}
.hr{width:1000px;}
.forord{width:960px;height:100px;border-bottom:1px solid #d6d6d6;}
.forord p{float:left;border:0px solid black;width:170px;height:85px;}
.forord .showimg{width:350px;}
.forord .showstatus{width:100px;}
.showord input[type=button]{width:60px;border:1px;height:30px;border-radius:4px;background-color:#F19D92;margin-top:10px;}
  .pagelist{ 
      text-align:center; 
      background:#f1f1f1; 
      padding:7px 0;
    }
    .pagelist a{
      text-decoration: none; 
      margin:0 5px; 
      border:#6185a2 solid 1px;   
      display:inline-block;
      padding:2px 6px 2px; 
      line-height:16px; 
      background:#fff; 
      color:#6185a2;
    }
    /*点击页码之后改变此点击页码的字体颜色和背景色，span为分页类内部的标签*/
    .pagelist span{
      margin:0 5px;
      border:#6185a2 solid 1px;
      display:inline-block;
      padding:2px 6px 1px; 
      line-height:16px;
      color:#fff; 
      background:#6185a2;
    }
	</style>
</head>
<body>
	<div class='showord'>
		<table width=100% align="center" class="table table-hover">
		<tr height=30px >
				<th width=30%>商品信息</th>
				<th width=13%>样式</th>
				<th width=12%>单价</th>
				<th width=15%>购买数量</th>			
				<th width=15%>评论状态</th>
				<th width=15%>操作</th>
			</tr>
		</table>
		<foreach name="list" item='vo'>			
		<table width=100% align='center' class='table table-hover' rules=cols frame=rhs>
		<thead>
			<tr>
				<th width=30% colspan='6'>下单时间:<{$vo.ordtime|date="Y-m-d H:i:s",###}>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;订单号:<{$vo.ordnum}></th>
			</tr>
		</thead>		
		
		<tr height=100px>
			<td width=85%>
				<?php foreach(json_decode($vo['content'],true) as $v){ ?>
				<div class="forord">
				<p class="showimg">
					<img src="__ROOT__/Uploads/prod/<{$v.goods_pic}>" alt="图片" class="pimg">
					<span style="display:inline-block;"><{$v.goods_name}></span>
				</p>
				<p>
					<span class="s1"><{$v.color}></span>
					<span class="s1"><{$v.mobtype}></span>
					<span class="s1"><{$v.memory}></span>
				</p>
				<p>
					&yen;<{$v.goods_price}>
				</p>
				<p>
					<{$v.num}>
				</p>
				<p class="showstatus">
				<if condition="$vo.effect eq 4 ">
					<switch name="v.comment">
						    <case value="0">
							<input type="button" value='去评价' class='comm' data-oid='<{$vo.oid}>_comm' data-id='<{$v.id}>_comm'>
					    </case>
					    <case value="1">已评价</case>
					    <default />
					</switch>
				<else />
					未评论
				</if>					
				</p>
				<br>
				</div>
				<?php } ?>
			</td>
			<td>
				<a href="<{:U('Home/Order/more')}>?oid=<{$vo.oid}>" target=_parent class="kan">查看详情</a><br>
				<switch name="vo.effect">
				    <case value="0">订单已取消</case>
				    <case value="1">
						<input type="button" value='去付款' class='pay' data-id='<{$vo.oid}>_pay'>
						<input type="button" value='取消订单' class='clos' data-id='<{$vo.oid}>_clos'>
				    </case>
				    <case value="2">
				    	等待店家发货<br>
						<input type="button" value='取消订单' class='clos' data-id='<{$vo.oid}>_clos'>
				    </case>
				    <case value="3">
				    	店家已经发货<br>
						<input type="button" value='确认收货' class='pok' data-id='<{$vo.oid}>_pok'>
				    </case>
				    <case value="4">订单已完成</case>
				    <default />
				</switch>
			</td>			
		</tr>		
	</table>
	</foreach>
	<div class='pagelist'><{$page}></div>
</div>

<script>
$(function(){
//去评论~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	$(document).on('click','.comm',function(){
		var id=parseInt($(this).attr('data-id'));
		var oid=parseInt($(this).attr('data-oid'));
		location.href="<{:U('Home/ProductComment/comment')}>?id="+id+"&oid="+oid;

	});
//取消订单
$(document).on('click','.clos',function(){
	var id=parseInt($(this).attr('data-id'));	
	$( "<div>确认取消吗???</div>" ).dialog({
			title:'确认',
			modal: true,
			buttons: {
	        确定: function(){
	          	$.post("<{:U('Home/Order/ocancel')}>",{oid:id},function(data){
					if(data.status){				
						location.reload();				
					}else{
						alert('请重试!');
					}			
				},'json');
	          	$(this).dialog( "close" );
	        },
	        取消: function(){
	        	$(this).dialog( "close" );
	        }

		}});
});	
//确认收货
$(document).on('click','.pok',function(){
	var oid = parseInt($(this).attr('data-id'));	
	$( "<div>确认收货吗???</div>" ).dialog({
			title:'确认',
			modal: true,
			buttons: {
	        确定: function(){
	        	console.log(oid);
	          	$.post('<{:U("sure")}>',{oid:oid},function(data){
					if(data.status){				
						location.reload();				
					}else{
						alert('请重试!');
					}			
				},'json');
	          	$(this).dialog( "close" );
	        },
	        取消: function(){
	        	$(this).dialog( "close" );
	        }

		}});
});
//去付款
$(document).on('click','.pay',function(){
	var oid = parseInt($(this).attr('data-id'));
	location.href="<{:U('Home/Cart/over')}>?oid="+oid;
});

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
})
</script>
</body>
</html>